// attackDamage.module.js

// 计算攻击伤害


// [[file:~/literate-programming/soul-hunter-awakening-damage-calculator-web-edition.org::*attackDamage.module.js][attackDamage.module.js:1]]
import * as WeaknessAttackDamage from "./weaknessAttackDamage.module.js"
import * as NonWeaknessAttackDamage from "./nonWeaknessAttackDamage.module.js"

function calculate(type,weakness,nonweakness){
    switch(type){
        case "weakness":
            return WeaknessAttackDamage.calculate(merge([nonweakness,weakness]))
        case "nonweakness":
            return NonWeaknessAttackDamage.calculate(nonweakness)
    }
}

function merge(objects){
    let result={}
    objects.forEach(function(object){
        Object.keys(object).forEach(function(key){
            result[key]=object[key]
        })
    })
    return result
}

export{calculate}
// attackDamage.module.js:1 ends here
